package com.demo.spring.enable.async;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class App {

	public static void main(String[] args) {
        // 用我们的配置文件来启动一个 ApplicationContext
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext("com.demo.spring.enable.async");
        System.out.println("==context 启动成功==");

        Student student = context.getBean(Student.class);

        // threadName: SimpleAsyncTaskExecutor-1
        // 声明了asyncExecutor，就会使用线程池：asyncExecutor-1
        student.say("aaa");
        // threadName: SimpleAsyncTaskExecutor-2
        // 声明了asyncExecutor，就会使用线程池：asyncExecutor-1
        student.say();
        // threadName: SimpleAsyncTaskExecutor-3
        // 声明了asyncExecutor，就会使用线程池：asyncExecutor-1
        student.say();
    }

}
